package rpcxtest

import (
	"context"
	"github.com/smallnest/rpcx/client"
	"log"
)

func ClientsMul()  {
	d, _ :=client.NewPeer2PeerDiscovery("tcp@localhost:8972","")
	xclient:=client.NewXClient("Arith",client.Failtry,client.RandomSelect,d,client.DefaultOption)
	defer xclient.Close()

	// #3
	args := &Args{
		A: 10,
		B: 20,
	}

	// #4
	reply := &Reply{}

	err:=xclient.Call(context.Background(),"Mul",args,reply)
	if err != nil {
		log.Fatalf("failed to call: %v", err)
	}

	log.Printf("%d * %d = %d", args.A, args.B, reply.C)
}
